package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.ysd.entity.Banner;
import com.ysd.util.DBManager;

public class BannerDaoImpl {
	public List<Banner> getBanner() {
		List<Banner> Banner = new ArrayList<Banner>();
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		Banner banner = null;
		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from Banner");
			while(rs.next()) {
				String bannerId = rs.getString("bannerId");
				String bannerImg = rs.getString("bannerImg");
				banner = new Banner(bannerId,bannerImg);
				Banner.add(banner);
			}
			return Banner;
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		}
	}
}
